<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<script type="text/javascript"
	src="<c:url value="/js/html5/html5.min.js"/>">
	icon
	Hui - iconfont
</script>
<script type="text/javascript"
	src="<c:url value="/js/respond/respond.min.js"/> "></script>
<script type="text/javascript"
	src="<c:url value="/js/PIE/2.0/PIE_IE678.js"/>"></script>

<link href="<c:url value="/css/H-ui.min.css"/>" rel="stylesheet"
	type="text/css" />
<link href="<c:url value="/css/H-ui.login.css"/>" rel="stylesheet"
	type="text/css" />
<link href="<c:url value="/css/Hui-iconfont/1.0.1/iconfont.css"/>"
	rel="stylesheet" type="text/css" />
	<%--分页--%>
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/layer/laypage.css"/>">
<title>项目列表</title>
</head>
<body class="pos-r">
	<div>
		<nav class="breadcrumb">
			<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
			资讯管理 <span class="c-gray en">&gt;</span> 资讯列表 <a
				class="btn btn-success radius r mr-20"
				style="line-height: 1.6em; margin-top: 3px"
				href="javascript:location.replace(location.href);" title="刷新"><i
				class="Hui-iconfont">&#xe68f;</i></a>
		</nav>

		<div class="text-c">
			<form action="<c:url value="/admin/information/list/0"/>">
				<input type="text" class="input-text" style="width: 250px"
					placeholder="输入资讯标题" name="title"> <input type="text"
					class="input-text" style="width: 250px" placeholder="输入资讯介绍"
					name="informationIntro">
				<button type="submit" class="btn btn-success radius" name="">
					<i class="Hui-iconfont">&#xe665;</i> 搜资讯
				</button>
			</form>
		</div>
		<div class="pd-20">
			<div class="text-c"></div>
			<div class="cl pd-5 bg-1 bk-gray mt-20">
				<form action="<c:url value="/admin/information/toadd" />">
					<button type="submit" class="btn btn-success radius" name="">
						添加资讯</button>
				</form>
				<span class="r">共有数据：<strong>${viewData.count }</strong> 条
				</span>
			</div>
			<div class="mt-20">
				<table
					class="table table-border table-bordered table-bg table-hover table-sort">
					<thead>
						<tr class="text-c">
							<th width="20%">标题</th>
							<th width="60%">资讯简介</th>
							<th width="20%">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${viewData.result}" var="prolist">
							<tr class="text-c va-m">
								<td>${prolist.title}</td>
								<td>${prolist.informationIntro}</td>
								<td><a
									href="<c:url value="/admin/information/toupdate?id=${prolist.id }"/>">编辑</a>&nbsp;<a
									style="text-decoration: none" class="ml-5"
									onClick="del_information('${prolist.id }')" title="删除">删除</a>&nbsp;<a
									href="<c:url value="/admin/information/informationDetail?id=${prolist.id }"/>">详情</a></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<div id="pagelayer" style=" float: right;margin-top: 10px;"></div>
			</div>
		</div>
	</div>
	<%--分页--%>
	<script type="text/javascript"  src="<c:url value="/js/laypage/1.2/laypage.js"/>"></script>
	<script type="text/javascript"
		src="<c:url value="/js/jquery/1.9.1/jquery.min.js"/>"></script>
	<script type="text/javascript"
		src="<c:url value="/js/layer/1.9.3/layer.js"/>"></script>
	<script type="text/javascript"
		src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<script type="text/javascript"
		src="<c:url value="/js/h-ui/2.3/H-ui.js"/>"></script>
	<script type="text/javascript"
		src="<c:url value="/js/h-ui/2.3/H-ui.admin.js"/>"></script>
	<script type="text/javascript">
		function del_information(id) {
			layer.confirm('是否删除该咨询？', {
				btn : [ '是', '取消' ],
				shade : false
			}, function() {
				$.ajax({
					type : "post",
					dataType : "json",
					data : {
						id : id
					},
					url : "<c:url value="/admin/information/delInformation"/>",
					success : function(data, textStatus) {
						layer.msg(data.msg, {
							icon : 6,
							time : 1000
						}, function() {
							location.reload(true);
						});
					},
					error : function(data) {
						layer.msg(data.msg, {
							icon : 5,
							time : 1000
						});
					}
				});
			});
		}

		$(function(){
			//        分页
			laypage({
				cont: $('#pagelayer'), //容器。值支持id名、原生dom对象，jquery对象,
				pages: "${viewData.pages}", //总页数
				skin: '#5eb95e', //加载内置皮肤，也可以直接赋值16进制颜色值，如:#c00
				groups: "7" ,//连续显示分页数
				skip: true, //是否开启跳页
				curr: "${viewData.page}", //获取hash值为fenye的当前页
				hash: '//', //自定义hash值
				jump: function(e, first){ //触发分页后的回调
					var pagesize = "${viewData.pageSize}";
					var url = e.curr;
					if(!first){//一定要加此判断，否则初始时会无限刷新
//                    location.href = e.curr==1?pagesize : (e.curr-1) * pagesize;
						location.href = url;
					}
				}
			});
		})

	</script>
</body>
</html>